var equipmentPowerTypeData = [];

$(document).ready(function() {
	showLoading();
	$('title', parent.document).html($('title').text());
	setBaseUrl();
	addTitle("equipmentPowerTypeUpdate");
	search();
    setTimeout(hideLoading, 700);
});

function search() {
	$('#EquipmentPowerType').val($("#detailID", parent.document).val());
	$ajax('searchEquipmentPowerType', 'searchEquipmentPowerTypeUpdate', searchEquipmentPowerType);
	$("#detailID", parent.document).val("");
}
function searchEquipmentPowerType(data) {
	totalPage = data && data.totalPage || 0;
	totalCnt = data && data.totalCnt || 0;
	equipmentPowerTypeData = data && data.equipmentTypeList || [];
	var index = undefined;
	createComBody("detailOneBody", equipmentPowerTypeTable, equipmentPowerTypeData[0], 1);
	if(equipmentPowerTypeData[0].enabled == true){
		$("#enabled").val(1);
	}else{
		$("#enabled").val(0);
	}
	$("#equipmentPowerType").attr("readonly", true);
}
function updateEquipmentPowerType(data){
	     var result = data && data.result;
	     if (result == "Success"){
	    	 showMessge(messageContent["Update.Success"], undefined, goback);
	     } else if (result == "NotFound"){
	    	 showMessge(messageContent["Update.Failed"]);
	     } else if (result == "UserIDNoNull"){
	         showMessge(messageContent["UserIDNoNull"]);
	     } else{
	    	 showMessge(messageContent["Update.Error"]);
	     }
}
function confirm(){
	return checkForm("saveForm", equipmentPowerTypeTable);
}
function goback() {
	window.parent.skipMenu('chargingEquipment/equipmentPowerType', 'drownDown2', '', 'equipmentPage', 'equipmentPowerType');
}